using octalforty.Waffle.ObjectModel.Business.Collections;
using octalforty.Waffle.ObjectModel.Business.Objects;

using octalforty.Waffle.Web.Engine.Web.UI;

namespace octalforty.Waffle.Web.UI.Views.Controls
{
    /// <summary>
    /// Displays a list of forums.
    /// </summary>
    public partial class ForumList : UserControl
    {
        #region Private Member Variables
        private ForumCollection forums;
        #endregion

        #region Public Properties
        /// <summary>
        /// Gets or sets a reference to the collection of <see cref="Forum"/> objects to be displayed.
        /// </summary>
        public ForumCollection Forums
        {
            get { return forums; }
            set { forums = value; }
        }
        #endregion

        /// <summary>
        /// Initializes a new instance of <see cref="ForumList"/> class.
        /// </summary>
        public ForumList()
        {
        }

        #region UserControl Members
        /// <summary>
        /// Binds a data source to the invoked server control and all its child controls.
        /// </summary>
        public override void DataBind()
        {
            base.DataBind();

            forumsRepeater.DataSource = Forums;
            forumsRepeater.DataBind();
        }
        #endregion
    }
}